package czopyk.model.persistence.actions;

import org.apache.log4j.Logger;

import czopyk.model.persistence.ValueExtractor;

public class PrintAction extends CommonAction implements Action {

	private final String value;
	private final Logger log;

	public PrintAction(String value, Logger log, ValueExtractor ve) {
		super(null, ve);
		this.log = log;
		this.value = value;
	}

	public void perform() {
		if (log != null) {
			log.info(ve.getValue(value));
		} else {
			System.out.println(ve.getValue(value));
		}
	}

}
